USE [master]
GO

-- =============================================
-- Author:       Justin Wallace Saunders
-- Create date:  01052010
-- Description:  %TargetDatabaseName% ASP.NET Registration
--               Invokes the ASP.NET Registration Command-line Utility.
-- Information:  http://msdn.microsoft.com/en-us/library/ms229862%28VS.80%29.aspx
-- =============================================
-- Enable SQL Server Advanced Options and XP_CmdShell
EXEC sp_configure N'Show Advanced Options', 1
RECONFIGURE WITH OVERRIDE
GO

EXEC sp_configure N'xp_cmdshell', 1
RECONFIGURE WITH OVERRIDE
GO

-- Execute ASP.NET Registration command
EXEC xp_cmdshell N'%AspNetAssemblyVersionRoot%\aspnet_regsql.exe -S %TargetDatabaseServer% -E -d %TargetDatabaseName% -A mr -Q', NO_OUTPUT
GO

-- Disable XP_CmdShell and SQL Server Advanced Options
EXEC sp_configure N'xp_cmdshell', 0
EXEC sp_configure N'Show Advanced Options', 0
RECONFIGURE WITH OVERRIDE
GO